package com.webware.one.shared.check;

import java.util.ArrayList;
import java.util.List;

public class InputCheck<E extends Comparable<E>> {
  public enum ECheck {
    NOTNULL, NOTEMPTY
  };

  private List<ECheck> checks = new ArrayList<ECheck>();

  public boolean check(E e) {
    for (ECheck check : checks) {
      switch (check) {
        case NOTNULL:
          if (e == null) return false;
        case NOTEMPTY:
          if (e.toString().isEmpty()) return false;
      }
    }
    return true;
  }

  public InputCheck(ECheck... params) {
    for (ECheck check : params)
      checks.add(check);
  }
}
